<template>
  <div class="header">
    <div class="logo">
      <span class="title"><i>MAILBOX</i></span>
      <div class="account">
        当前用户：<span>{{nick}}({{mobile}})</span>
        <el-button type="text" @click="modifyPwd">修改密码</el-button>
        <el-button type="text" @click="signOut">退出</el-button>
      </div>
    </div>
    <div class="topbg"></div>
  </div>
</template>

<script>
import { storage } from '../../utils/storage.js'
export default {
  data () {
    return {
      nick: storage.getSession('nick'),
      mobile: storage.getSession('mobile'),
    }
  },
  methods: {
    modifyPwd() {
      this.$router.push('/modify')
    },
    signOut() {
      sessionStorage.clear();
      setTimeout(() => {
        this.$router.replace('/login')
      }, 500)
    }
  },
}
</script>

<style scoped>
.header {
  position: relative;
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
  width: 100%;
  height: 60px;
  box-shadow: 0 1px 2px 0 RGBA(0,0,0,.3);
}
.logo {
  position: absolute;
  box-sizing: border-box;
  left: 0;
  width: 100%;
  padding: 0 20px;
  z-index: 6;
  text-align: left;
}
.title {
  /* display: inline-block; */
  font-size: 24px;
  line-height: 50px;
  width: 100px;
  text-align: left;
  color: #000;
  font-weight: 600;
}
.account {
  display: inline-block;
  line-height: 50px;
  margin-left: 100px;
}
.account span {
  font-weight: 600;
}
.account button {
  color: #333;
  margin-left: 30px;
  font-size: 12px;
  padding: 5px 7px;
}
.account button:hover {
  background: #951b1b;
  color: #fff;
}
</style>
